#define  _CRT_SECURE_NO_WARNINGS 1
#include"vector.h"
template<class T>
void jz::vector<T>::push_back(size_t x)
{
	if (m_finish == m_endofstorage)
	{
		size_t newcapacity = capacity() == 0 ? 4 : capacity() * 2;
		reserve(newcapacity);
	}
	*m_finish = x;
	m_finish++;
}
template<class T>
void jz::vector<T>::reserve(size_t n)
{
	if (n > capacity())
	{
		size_t old = size();
		T* tem = new T[n];
		if (m_start)
		{
			memcpy(tem, m_start, sizeof(T) * old);
			delete[] m_start;
		}
		m_start = tem;
		m_finish = m_start + old;
		m_endofstorage = m_start + n;
	}
}
template<class T>
void jz::vector<T>::resize(size_t n, T val)
{

}
template<class T>
void jz::vector<T>::pop_back()
{
	assert(size() > 0);
	m_finish--;
}
template<class T>
void jz::vector<T>::insert(iterator pos, const T& x)
{
	assert(pos >= m_start && pos <= m_finish);
	if (m_finish == m_endofstorage)
	{
		size_t len = pos - m_start;
		reserve(capacity() == 0 ? 4 : capacity() * 2);
		pos = m_start + len;
	}
	memmove(pos + 1, pos, sizeof(T)*(m_finish - pos));
	*pos = x;
	m_finish++;

}
template<class T>
void jz::vector<T>::erase(iterator pos)
{

}
